package com.hfxt.controller;

import com.hfxt.entity.Contact;
import com.hfxt.service.ContactService;
import com.hfxt.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ContactController {
    @Autowired
    private ContactService contactService;

    @RequestMapping("/contact/list")
    public Result list(String cname, Integer pageIndex, Integer pageSize) {
        return contactService.list(cname, pageIndex, pageSize);
    }

    @RequestMapping("/contact/save")
    public Result save(@RequestBody Contact contact) {
        return contactService.save(contact);
    }

    @RequestMapping("/contact/del")
    public Result del(Long id) {
        return contactService.del(id);
    }
}
